package com.example.cloudsentinel.config;

import com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect;
import feign.RequestInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置 切面（注解） 的支持
 */
@Configuration
public class SentinelAspectConfiguration {



    @Bean
    public SentinelResourceAspect sentinelResourceAspect() {
        return new SentinelResourceAspect();
    }

    @Value("${spring.application.name}")
    public String applicationName;

    @Bean
    public RequestInterceptor feignInterceptor() {
        return new FeignInterceptor(applicationName);
    }

}
